<script setup lang="ts">
import type {ArticleInfoEs} from "@/types/entity/ArticleInfoEs";

const {Article} = defineProps<{
  Article: ArticleInfoEs
}>()

const router = useRouter()
const onClick = () => {
  const {href} = router.resolve({
    path: '/article/ArticleDetail',
    query: {
      articleId: Article.articleId
    }
  });
  window.open(href, '_blank')
}
</script>

<template>
  <div>
    <div class="article-item" @click="onClick">
      <div class="article-item-title" v-html="Article.articleName">
      </div>
      <div class="flex gap-5px items-center">
        <span>作者:{{ Article.author }}</span>
      </div>
      <div class="text-ellipsis" v-html="Article.articleContent"></div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.article-item {
  width: 100%;
  margin-bottom: 10px;
  padding: 6px;
  border-bottom: 2px solid #f3f4f6;
  cursor: pointer;
  &:hover {
    background-color: #f7f8fa;
  }
  .article-item-title {
    font-size: 14px;
    color: #333;
    font-weight: 700;
  }
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}
</style>
